<?php
$database = new SQLiteDatabase($yourfile, 0666, $error);
if (!$database) {
    $error = (file_exists($yourfile)) ? "Impossible to open, check permissions" : "Impossible to create, check permissions";
    die($error);
}
$query = $database->query("SELECT name FROM sqlite_master WHERE type='table'", SQLITE_ASSOC, $query_error); #Lists all tables
if ($query_error)
    die("Error: $query_error"); #This means that most probably we catch a syntax error
if (!$query)
    die("Impossible to execute query.") #As reported above, this means that the db owner is different from the web server's one, but we did not commit any syntax mistake.
print $query->numRows();
while ($row = $query->fetch())
    print($row['name']."\n");
?>